package com.ibiaoke.boss.controller;

import com.ibiaoke.common.base.Page;
import com.ibiaoke.common.consts.CommonConsts;
import com.ibiaoke.common.response.Res;
import com.ibiaoke.system.entity.TopicPage;
import com.ibiaoke.system.entity.XcxTopicPage;
import com.ibiaoke.system.service.TopicPageService;
import com.ibiaoke.system.service.XcxTopicPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class WxTopicPageController {


    @Autowired
    private TopicPageService topicPageService;

    @Autowired
    private XcxTopicPageService xcxTopicPageService;


    @RequestMapping("listTopicPage")
    @ResponseBody
    public Res listTopicPage(Integer position){
        List<TopicPage> topicPages = topicPageService.listTopicPage(position, CommonConsts.YES,null);
        return Res.create().addResponse("topicPages",topicPages);
    }

    @RequestMapping("getTopicPage")
    @ResponseBody
    public Res getTopicPage(Integer topicPageId){
        TopicPage topicPage = topicPageService.getTopicPage(topicPageId);
        return Res.create().addResponse("topicPage",topicPage);
    }

    /****************************************新专题****************************************/
    @ResponseBody
    @RequestMapping("newListTopicPage")
    public Res newListTopicPage(Integer position ,Integer shopId){
        List<XcxTopicPage> xcxTopicPageList = xcxTopicPageService.listTopicPage(position,shopId, CommonConsts.YES,null);
        return Res.create().addResponse("topicPages",xcxTopicPageList);
    }

    @ResponseBody
    @RequestMapping("newGetTopicPage")
    public Res newGetTopicPage(Integer topicPageId){
        XcxTopicPage topicPage = xcxTopicPageService.getTopicPage(topicPageId);
        return Res.create().addResponse("topicPage",topicPage);
    }
}
